import { createBrowserRouter, Navigate } from "react-router-dom";
import Login from "../pages/login";
import Home from "../pages/home";
import HOC from "./HOC";
import { Children } from "react";
//创建history的路由模式
const router = createBrowserRouter([
  {
    path: "/",
    element: <Navigate to="/login" />,
  },
  {
    path: "/login",
    element: <Login />,
  },
  {
    path: "/home",
    element: <Home />,
    children: [
      {
        path: "",
        element: <Navigate to="/home/Overview" />,
      },
      {
        // 总览
        path: "Overview",
        element: <HOC href="/home/Overview" />,
      },
      {
        //流调管理
        path: "CurrentModulation",
        // element:<Navigate to='/home/CurrentModulation/Corroboration'/>,
        children: [
          {
            path: "Corroboration",
            element: <HOC href="/home/CurrentModulation/Corroboration" />,
          },
          {
            path: "TightJoint",
            element: <HOC href="/home/CurrentModulation/TightJoint" />,
          },
        ],
      },
      {
        //指挥调度
        path: "Command",
        element: <HOC href="/home/Command" />,
      },
      {
        //异常警告
        path: "Abnormal",
        element: <HOC href="/home/Abnormal" />,
      },
      {
        //居家检测
        path: "HomeTest",
        children: [
          {
            path: "Abnormal",
            element: <HOC href="/home/HomeTest/Abnormal" />,
          },
          {
            path: "NeedTo",
            element: <HOC href="/home/HomeTest/NeedTo" />,
          },
          {
            path: "NewAdd",
            element: <HOC href="/home/HomeTest/NewAdd" />,
          },
          {
            path: "Testing",
            element: <HOC href="/home/HomeTest/Testing" />,
          },
        ],
      },
      {
        //通知公告
        path: "Noitce",
        element: <HOC href="/home/Noitce" />,
      },
      {
        //统计分析
        path: "Statistics",
        children: [
          {
            path: "Information",
            element: <HOC href="/home/Statistics/Information" />,
          },
          {
            path: "TightJointPeo",
            element: <HOC href="/home/Statistics/TightJointPeo" />,
          },
          {
            path: "AbnormalErr",
            element: <HOC href="/home/Statistics/AbnormalErr" />,
          },
        ],
      },
      {
        //设置
        path: "SetUp",
        children: [
          {
            path: "Organization",
            element: <HOC href="/home/SetUp/Organization" />,
          },
          {
            path: "Account",
            element: <HOC href="/home/SetUp/Account" />,
          },
          {
            path: "Role",
            element: <HOC href="/home/SetUp/Role" />,
          },
          {
            path: "Journal",
            element: <HOC href="/home/SetUp/Journal" />,
          },
          {
            path: "Data",
            element: <HOC href="/home/SetUp/Data" />,
          },
          {
            path: "System",
            element: <HOC href="/home/SetUp/System" />,
          },
        ],
      },
    ],
  },
  {
    path: "*",
    element: <div>路径错误404</div>,
  },
]);
export default router;
